package org.example.Day4.Regex;

import java.util.Scanner;

public class Test {
    public static void main(String[] args){
        checkIphone();
    }
    public static void checkIphone(){
        while (true){
            System.out.println("请输入您的手机号");
            Scanner sc = new Scanner(System.in);
            String Iphone = sc.nextLine();
            if(Iphone.matches("(1[3-9]\\d{9})|(0\\d{2,7}-?[1-9]\\d{4,19})")){
                System.out.println("您输入号码格式正确");
                break;

            }else{
                System.out.println("请重新输入");
            }
        }
    }
}
